Adding Palette Message Handlers

The following example illustrates simple message handlers for the WM_PALETTECHANGEDK1.BMN and WM_QUERYNEWPALETTEGE2TRE messages. The example uses the DrawDibRealizeA7VV86 function to process the WM_QUERYNEWPALETTE message.

Your application should respond to the WM_QUERYNEWPALETTE message by invalidating the destination window to let the DrawDibDrawCFJFPG function redraw an image. You should respond to the WM_PALETTECHANGED message by using the DrawDibRealize function to realize the palette.

case WM_PALETTECHANGED:

     if ((HWND)wParam == hwnd)

           break;

case WM_QUERYNEWPALETTE:

     hdc = GetDC(hwnd);

     f = DrawDibRealize(hdd, hdc, FALSE) > 0;

     ReleaseDC(hwnd, hdc);

     if (f)

           InvalidateRect(hwnd, NULL, TRUE);

     break;